Imports System.Xml
Imports System.Data.OleDb

Public MustInherit Class BaseImporter

    Protected _conn As OleDbConnection

    Private Const SelectSQL As String = "SELECT file_id FROM Files WHERE imported_id = {0} AND imported_from = '{1}'"

    Public MustOverride ReadOnly Property Source() As String
    'Public MustOverride ReadOnly Property ItemXPath() As String

    Protected MustOverride Sub AddItem(ByVal item As XmlElement)

    Private Function AlreadyAdded(ByVal id As Integer) As Boolean

        Dim added As Boolean = False

        Dim SelectCommand As New OleDbCommand
        SelectCommand.Connection = _conn
        SelectCommand.CommandType = CommandType.Text
        SelectCommand.CommandText = String.Format(SelectSQL, _
                                                  id.ToString, _
                                                  Source.ToString)

        Dim result As Object = SelectCommand.ExecuteScalar
        If result Is Nothing Or _
           result Is System.DBNull.Value Then
            added = False
        ElseIf CType(result, Integer) > 0 Then
            added = True
        Else
            added = False
        End If

        Return added

    End Function

    Public MustOverride Sub Import(ByVal filePath As String)


End Class
